package com.yt.lxh.dto.activity.coupon;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yt.lxh.enums.CouponExpireType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.util.Date;

@Data
@ApiModel(description = "发布优惠券")
public class PublishCouponDTO {

    @ApiModelProperty(value = "优惠券ID", required = true)
    @NotBlank(message = "优惠券ID不能为空")
    private String id;

    @ApiModelProperty(value = "优惠券有效期类型；0(天数) 1(指定时间)；默认 按天数", required = true)
    @NotNull(message = "优惠券有效期类型不能为空")
    private CouponExpireType expireType = CouponExpireType.DAY;

    @ApiModelProperty(value = "可以领取的开始日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss")
    @Future(message = "开始日期必须大于当前日期")
    private Date startTime;

    @ApiModelProperty(value = "可以领取的结束日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss")
    @Future(message = "结束日期必须大于当前日期")
    private Date endTime;

    @ApiModelProperty(value = "过期时间", required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss")
    @Future(message = "过期时间必须大于当前日期")
    private Date expireTime;

    @ApiModelProperty(value = "过期天数 ---> 按天数计算")
    @Min(value = 1, message = "过期天数最小为1天")
    private Integer expireDay;

}
